package org.xinjiang.data.migration.flush.controller;


import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.Operation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.xinjiang.data.migration.common.response.Result;
import org.xinjiang.data.migration.flush.dto.res.FlushResultDTO;
import org.xinjiang.data.migration.flush.service.ICrimeRelationshipsFlushService;
import org.xinjiang.data.migration.hainan.dto.req.JzdxQueryDTO;

/**
 * @Description: 犯罪类型具体罪名同步刷数据
 */
@Api(tags = "犯罪类型具体罪名同步刷数据")
@RestController
@RequestMapping("/flush/crime")
@Slf4j
public class CrimeRelationshipsFlushController {

    @Autowired
    private ICrimeRelationshipsFlushService crimeRelationshipsEntityFlushService;

    /**
     * 用途，统计表，需要先同步矫正对象
     *
     * @return Void
     */
    @Operation(summary = "全量刷数据")
    @PostMapping(value = "/execute-all")
    public Result<FlushResultDTO> executePart(@Validated @RequestBody JzdxQueryDTO dto) {
        FlushResultDTO result = crimeRelationshipsEntityFlushService.flushAll(dto);
        return Result.ok(result);
    }
}
